function strLength(str) {
	return ($.browser.msie && str.indexOf('\n') != -1) ? str.replace(/\r?\n/g, '_').length : str.length;
}
function isUndefined(variable) {
	return typeof(variable) == 'undefined' ? true : false;
}
function insertUbb(objId,text,textEnd){
	var obj = document.getElementById(objId);
	obj.focus();
	if(isUndefined(textEnd)){
		textEnd = "";
	}
	startlen = strLength(text);
	endlen = strLength(textEnd);
	if(!isUndefined(obj.selectionStart)) {
		var opn = obj.selectionStart + 0;
		if(textEnd != "") {
			text = text + obj.value.substring(obj.selectionStart, obj.selectionEnd) + textEnd;
		}
		obj.value = obj.value.substr(0, obj.selectionStart) + text + obj.value.substr(obj.selectionEnd);
		obj.selectionStart = opn + strLength(text) - endlen;
		obj.selectionEnd = opn + strLength(text) - endlen;
	} else if(document.selection && document.selection.createRange) {
		var sel = document.selection.createRange();
		if(textEnd != "") {
			text = text + sel.text + textEnd;
		}
		sel.text = text.replace(/\r?\n/g, '\r\n');
		sel.moveStart("character", -endlen);
		sel.moveEnd("character", -endlen);
		sel.select();
	} else {
		obj.value += text;
	}

}

function vp_(obj) {
	window.open("/viewpic.jsp?imgUrl=" + obj.src);
}

function aw_(obj) {
	var ubbImgWidth=window['ubbImgWidth'];
	if (ubbImgWidth && screen.width <= 1024) {
		ubbImgWidth = 659;
	}
	if (ubbImgWidth && obj.width > ubbImgWidth) {
		obj.width='auto';
		obj.style.width='';
		obj.style.height='';
		obj.width=ubbImgWidth;
	}
}
